package com.yl.nettylearning.netty.day10;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

/**
 * @author yangl
 */
public class ServerChannelInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        //入站的handler解码
        pipeline.addLast(new ByteToLongDecoder2());
        //入站的编码
        pipeline.addLast(new LongToByteEncoder());
        //加入一个自定义的handler处理业务逻辑
        pipeline.addLast(new ServerHandler());
    }
}
